<script setup lang="ts">
const text = defineProps(["placeholder", "hide"]);
const emit = defineEmits(["searchResult"]);
const search = ref<string>("");
document.addEventListener("keydown", (e) => {
  if (e.key == "Enter") {
    emit("searchResult", search.value);
  }
});
function cancel() {
  uni.navigateBack({ delta: 1 });
}
</script>

<template>
  <wd-search
    v-model="search"
    :hide-cancel="text.hide"
    placeholder-left
    :placeholder="text.placeholder"
    @cancel="cancel"
  />
</template>

<style lang="scss" scoped></style>
